package com.fifth.apartment.others;

import com.fifth.apartment.result.Result;
import com.fifth.apartment.service.KillService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * TODO
 *
 * @author Dao
 * @since 2024/7/16
 */
@RestController
//@RequestMapping("/admin/kill")
@Slf4j
//@Api(tags = "秒杀接口")
public class KillController {

    @Autowired
    private  KillService service;
    @PostMapping
    @ApiOperation("秒杀")
    public Result kill(String pid ){
        String uid = UUID.randomUUID().toString();
        Result result = service.killByLua(pid,uid);
        return result;
    }
}
